import sys
import importer_v2 as importer
import db
import baostock as bs

def load(stock_code):
    clear_data = importer.load_sharding(None, stock_code)
    if (len(clear_data) > 0):
        bs.login()
        for data in clear_data:
            importer.load_by_code(data["stock_code"],data["sharding_table"], None, None, True)   
        bs.logout()

if __name__ == '__main__':
    args = ""
    if len(sys.argv) > 1:
        args = sys.argv[1]
    load(args)